target=BFS SSSP GC BC CC PR

amd_flags=-D LANE_SHFT=6
nv_flags=-arch=sm_35 -D LANE_SHFT=5 --expt-extended-lambda

HIP_PATH=/opt/rocm/hip
ifeq ($(shell $(HIP_PATH)/bin/hipconfig --platform), hcc)
arch_flags=$(amd_flags)
endif

ifeq ($(shell $(HIP_PATH)/bin/hipconfig --platform), nvcc)
arch_flags=$(nv_flags)
endif

cxx_flags=-O3 -std=c++11 -I../src $(arch_flags) #-D __USE_TEXTURE__ 

all:
	make $(target)

SSSP: ../application/sssp.cpp
	hipcc $(cxx_flags) -o $@ $<

BFS: ../application/bfs.cpp
	hipcc $(cxx_flags) -o $@ $<

GC: ../application/gc.cpp
	hipcc $(cxx_flags) -o $@ $<

BC: ../application/bc.cpp
	hipcc $(cxx_flags) -o $@ $<

CC: ../application/cc.cpp
	hipcc $(cxx_flags) -o $@ $<

PR: ../application/pagerank.cpp
	hipcc $(cxx_flags) -o $@ $<

clean: 
	rm -f $(target)
